home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 03 Pathfinding with Astar / 02 Higgins / Listing3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-12-09  |  985 b   |  31 lines

  1. /* Copyright (C) Dan Higgins, 2001. 
  2.  * All rights reserved worldwide.
  3.  *
  4.  * This software is provided "as is" without express or implied
  5.  * warranties. You may freely copy and compile this source into
  6.  * applications you distribute provided that the copyright text
  7.  * below is included in the resulting source code, for example:
  8.  * "Portions Copyright (C) Dan Higgins, 2001"
  9.  */
  10.  
  11. // This class definition is:
  12. template<class TSTORAGE, class TGOAL, class TMAP>
  13. class AStarMachine : public AStarBase, public TSTORAGE
  14.  
  15.  
  16. // To create the forest A* machine, we combine the storage, 
  17. // goal and map classes, and use it like:
  18.  
  19. // typedef for clarity in code example.
  20. typedef AStarForestStorage ASTARSForest;
  21. typedef AStarForestGoal ASTARGForest;
  22. AStarMachine<ASTARSForest, ASTARGForest, Map> theMachine;
  23.  
  24. // set the source and destination
  25. theMachine.SetSource(theSourcePoint);
  26. theMachine.SetDestination(theDestinationPoint);
  27.  
  28. // run it!
  29. theMachine.RunAStar();
  30.  
  31.